package com.zy.openchat.core.model.user;

import android.text.TextUtils;

public class SessionInfo {
    public static final int PC_FOR_WINDOWS = 1;
    public static final int PC_FOR_MAC = 2;
    public static final int WEB = 3;
    public static final int IOS = 4;
    public static final int ANDROID = 5;

    public long id;
    public boolean is_current;
    public boolean is_password_pending;
    public boolean can_accept_secret_chats;
    public boolean can_accept_calls;
    public long api_id;
    public String application_name;
    public String application_version;
    public String is_official_application;
    public String device_model;
    public String platform;
    public String system_version;
    public long log_in_date;
    public long last_active_date;
    public String ip;
    public String country;
    public String region;


    public int getPlatformType(){
        if(api_id == 81){
            return WEB;
        }
        if(TextUtils.isEmpty(device_model)){
            return ANDROID;
        }
        String deviceModeLower = device_model.toLowerCase();
        if(deviceModeLower.contains("iphone")||deviceModeLower.contains("ios")){
            return IOS;
        }
        if(deviceModeLower.contains("windows")){
            return PC_FOR_WINDOWS;
        }
        if(deviceModeLower.contains("mac")){
            return PC_FOR_MAC;
        }
        return ANDROID;
    }


}
